You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
build(release): show operators the TN release their node runs - #1499
Release tarballs and the ghcr image now carry the TN release, its commit and the commit time at link time. A release or image build fails if its kwild reports any other version.
What changes
release.yaml builds all four kwild binaries with -ldflags that set TNVersion to the tag without the v, TNCommit to the release commit and TNBuildTime to the commit time.
A new release step runs the Linux AMD64 binary and fails unless kwild version --output json and kwild --version print the tag without the v. The other three binaries get the same LDFLAGS.
Setup Go reads go.mod instead of 1.22.x. The Go version stays the same: the v2.6.8 release binary already reports go1.25.3, because the toolchain switched to the one in go.mod.
deployments/Dockerfile takes TN_VERSION, TN_COMMIT and TN_BUILD_TIME build args and passes them as ldflags. A local build without them reports 0.0.0-dev.
publish-node-image.yaml passes the metadata version, github.sha and the commit time. It first builds and loads the image, runs kwild version --output json in it, and only pushes if the version matches.
cmd/version copies TNVersion into kwil-db's KwilVersion when a build sets it. kwild --version, the Starting kwild version log line and kwil_ver in the RPC version methods then report the TN release too.
The upgrade guide shows what the version commands print, what 0.10.1 means, and how to read the release from a Docker node's image label. The operator guide links to it.
What each output prints
I built kwild the way release.yaml does, with a test tag v2.6.99:
$ kwild version
Version: 2.6.99
Git commit: d4521cc5f
Built: 2026-11-25T11:09:15+07:00 (commit time)
Go version: go1.25.3
OS/Arch: linux/amd64
$ kwild version --output json | jq -c .result
{"version":"2.6.99","git_commit":"d4521cc5f","build_time":"2026-11-25T11:09:15+07:00 (commit time)","go_version":"go1.25.3","os":"linux","arch":"amd64"}
$ kwild --version
kwild version 2.6.99
$ kwild start --version
kwild version 2.6.99
On a local node started from that binary:
The log says Starting kwild version 2.6.99.
user.version returns {"service":"user","api_ver":"0.2.0","major":0,"minor":2,"patch":0,"kwil_ver":"2.6.99"}. chain.version and function.version also return kwil_ver2.6.99.
kwild admin version prints 2.6.99.
/api/v1/health/user still reports "version":"0.2.0", and /api/v1/health still reports function 0.1.0 and user 0.2.0.
The same build without the ldflags, which is how releases build today, prints 0.10.1 in all of these places.
The image built with the new build args gives the same JSON from docker run --rm --entrypoint /app/kwild <image> version --output json, and its org.opencontainers.image.version label reads 2.6.99.
Why setting KwilVersion is safe
I looked for every reader of kwil-db's version.KwilVersion and of kwil_ver in kwil-db at the commit node pins, in node itself, the gateway, sdk-go, sdk-js, sdk-py, kwil-js and the indexer. Every reader only prints or returns the value, and none of them compares or parses it.
Only 8 files in kwil-db import its version package. They are the cobra --version, the startup log, the version command and the four RPC version handlers. Nothing in consensus, peers, block sync, state sync, snapshots or migrations imports it.
Peers are filtered by a chain ID protocol. The libp2p agent version appears only in a log line, and kwil-db sets no user agent, so that value is not KwilVersion either.
The gateway's backend version check reads the version field of /api/v1/health/user. That field is the user service API version, 0.2.0, and this change leaves it alone.
The SDKs, kwil-js and the indexer have no reader of kwil_ver or KwilVersion.
I set KwilVersion in an init() in node rather than with a second -X flag. Each build then has one value to stamp, and a rename in kwil-db breaks the build instead of silently doing nothing.
Checks I ran
The release.yaml steps run locally with tag v2.6.99 on this commit: the check passes. The same build without ldflags fails it with kwild version prints '0.10.1', but the release is '2.6.99'.
docker build -f deployments/Dockerfile with the new build args, then the image check: passes. A build without the args reports 0.0.0-dev.
scripts/build/binary, which task build runs, prints the git describe version (2.6.8-5-gd4521cc5). Before this change, kwild --version printed 0.10.1 for that build.
A local node on Postgres: the log line, the RPC version methods, kwild admin version and the health endpoints, as listed above.
actionlint 1.7.7 on both workflows, go build ./..., go vet ./cmd/... ./app/... and gofmt -l: clean.
A manual image build from main stamps the metadata version (latest or sha-<7>) as its kwild version. The commit is still the real one.
Review in Wizard
Read and comment on these documents without using GitHub:
No actionable comments were generated in the recent review.
Walkthrough
Release and Docker builds now embed TN release, commit, and build-time metadata. Version initialization exposes the TN release through kwil-db’s version value when configured. Release and image workflows check version output, and the guides explain version formats and Docker release identification.
Changes: Release Version Reporting
Layer / File(s)
Summary
Version reporting and Docker build cmd/version/utils.go, deployments/Dockerfile, docs/node-operator-guide.md, docs/node-upgrade-guide.md
Version initialization assigns TNVersion to kwilVersion.KwilVersion when set. The Docker build links release metadata into the binary. The guides describe version output, older binaries, and Docker release identification.
Release binary stamping and checks .github/workflows/release.yaml
The release workflow derives the Go version from go.mod and passes version, commit, and build-time linker flags to platform builds. It checks Linux AMD64 version output before packaging.
Node image build and version check .github/workflows/publish-node-image.yaml
The image workflow captures commit time, builds an image with release metadata, checks its JSON version, and passes the same metadata to the push build.
This change makes release binaries and images report the TN release version and commit, and fails builds on a mismatch. No actionable merge-blocking risk was found.
Pre-merge checks: 4
Check name
Status
Explanation
Description Check
Check skipped - CodeRabbit’s high-level summary is enabled.
Title check
The title "build(release): show operators the TN release their node runs" matches the main change. The PR stamps release binaries and container images with the TN release, commit, and commit time, and…
Linked Issues check
Issue #1493 has one directly linked target, and it has coding requirements. (1) Release binaries and images carry the TN version and commit. .github/workflows/release.yaml sets LDFLAGS with `TNVer…
Out of Scope Changes check
All changed files map to #1493 objectives. release.yaml and publish-node-image.yaml stamp and verify the version. deployments/Dockerfile accepts build args for the image. cmd/version/utils.go …
Full details: Title check
Explanation
The title "build(release): show operators the TN release their node runs" matches the main change. The PR stamps release binaries and container images with the TN release, commit, and commit time, and adds a check that fails builds when the reported version differs from the tag. The title names the operator-facing goal, which the linked issue #1493 also requests. It is specific and follows conventional commit style, so it passes.
Full details: Linked Issues check
Explanation
Issue #1493 has one directly linked target, and it has coding requirements. (1) Release binaries and images carry the TN version and commit. .github/workflows/release.yaml sets LDFLAGS with TNVersion, TNCommit and TNBuildTime for all four builds. The Dockerfile and publish-node-image.yaml pass the same values (per PR summary). (2) kwild version, kwild --version, the startup log and user.version report the release. At head, cmd/version/utils.goinit() sets kwilVersion.KwilVersion to TNVersion when it is set. The version command reads TNVersion through getVersion(), and the RPC kwil_ver reads KwilVersion. (3) A release fails when its binary reports another version. The release workflow checks kwild version --output json and kwild --version against $VERSION on the Linux AMD64 binary and exits 1 on mismatch. (4) Health endpoints keep their API versions. The change only sets KwilVersion and does not alter the health handlers, per the PR description. (5) Guides explain the version output and Docker label lookup, per the upgrade and operator guide changes. Runtime results (node log, RPC output, image label, release check run) are author-reported and were not re-executed here. The code evidence supports each requirement.
Full details: Out of Scope Changes check
Explanation
All changed files map to #1493 objectives. release.yaml and publish-node-image.yaml stamp and verify the version. deployments/Dockerfile accepts build args for the image. cmd/version/utils.go copies TNVersion into KwilVersion. The docs cover the version output. The setup-go change from 1.22.x to go-version-file: go.mod is a build-environment change in the release workflow. The PR description states the Go version is unchanged, so it stays within the release build scope. No unrelated change was found in the reviewed files.
Finishing Touches
Generate unit tests (beta)
Commit to this branch
Create a new PR
Fix failing CI checks
Commit to this branch
Create a new PR
Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.
File: No configuration file from this repository applied
Commit: Unavailable
Layers: defaults
Review profile: CHILL
Plan: Advanced
Run ID: 12627e2a-4bdd-4d5f-932b-a24b6c6e0158
Commits
Reviewing files that changed from the base of the PR and between 9e00868 and d4521cc.
Files selected for processing: 6
.github/workflows/publish-node-image.yaml
.github/workflows/release.yaml
cmd/version/utils.go
deployments/Dockerfile
docs/node-operator-guide.md
docs/node-upgrade-guide.md
Included review availability: This review used your included allowance. Your plan provides up to 1 included review per hour; 0 remain after this review.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
resolves: #1493
Release tarballs and the ghcr image now carry the TN release, its commit and the commit time at link time. A release or image build fails if its kwild reports any other version.
What changes
release.yamlbuilds all four kwild binaries with-ldflagsthat setTNVersionto the tag without thev,TNCommitto the release commit andTNBuildTimeto the commit time.kwild version --output jsonandkwild --versionprint the tag without thev. The other three binaries get the sameLDFLAGS.go.modinstead of1.22.x. The Go version stays the same: the v2.6.8 release binary already reports go1.25.3, because the toolchain switched to the one ingo.mod.deployments/DockerfiletakesTN_VERSION,TN_COMMITandTN_BUILD_TIMEbuild args and passes them as ldflags. A local build without them reports0.0.0-dev.publish-node-image.yamlpasses the metadata version,github.shaand the commit time. It first builds and loads the image, runskwild version --output jsonin it, and only pushes if the version matches.cmd/versioncopiesTNVersioninto kwil-db'sKwilVersionwhen a build sets it.kwild --version, theStarting kwild versionlog line andkwil_verin the RPC version methods then report the TN release too.0.10.1means, and how to read the release from a Docker node's image label. The operator guide links to it.What each output prints
I built kwild the way
release.yamldoes, with a test tagv2.6.99:On a local node started from that binary:
Starting kwild version 2.6.99.user.versionreturns{"service":"user","api_ver":"0.2.0","major":0,"minor":2,"patch":0,"kwil_ver":"2.6.99"}.chain.versionandfunction.versionalso returnkwil_ver2.6.99.kwild admin versionprints2.6.99./api/v1/health/userstill reports"version":"0.2.0", and/api/v1/healthstill reports function0.1.0and user0.2.0.The same build without the ldflags, which is how releases build today, prints
0.10.1in all of these places.The image built with the new build args gives the same JSON from
docker run --rm --entrypoint /app/kwild <image> version --output json, and itsorg.opencontainers.image.versionlabel reads2.6.99.Why setting KwilVersion is safe
I looked for every reader of kwil-db's
version.KwilVersionand ofkwil_verin kwil-db at the commit node pins, in node itself, the gateway, sdk-go, sdk-js, sdk-py, kwil-js and the indexer. Every reader only prints or returns the value, and none of them compares or parses it.versionpackage. They are the cobra--version, the startup log, theversioncommand and the four RPC version handlers. Nothing in consensus, peers, block sync, state sync, snapshots or migrations imports it.KwilVersioneither.versionfield of/api/v1/health/user. That field is the user service API version,0.2.0, and this change leaves it alone.kwil_verorKwilVersion.The kwil-db code I read for this:
I set
KwilVersionin aninit()in node rather than with a second-Xflag. Each build then has one value to stamp, and a rename in kwil-db breaks the build instead of silently doing nothing.Checks I ran
release.yamlsteps run locally with tagv2.6.99on this commit: the check passes. The same build without ldflags fails it withkwild version prints '0.10.1', but the release is '2.6.99'.docker build -f deployments/Dockerfilewith the new build args, then the image check: passes. A build without the args reports0.0.0-dev.scripts/build/binary, whichtask buildruns, prints thegit describeversion (2.6.8-5-gd4521cc5). Before this change,kwild --versionprinted0.10.1for that build.kwild admin versionand the health endpoints, as listed above.actionlint1.7.7 on both workflows,go build ./...,go vet ./cmd/... ./app/...andgofmt -l: clean.A manual image build from
mainstamps the metadata version (latestorsha-<7>) as its kwild version. The commit is still the real one.Review in Wizard
Read and comment on these documents without using GitHub:
Summary by CodeRabbit
Bug Fixes
Documentation